// pages/order/order.js
var app = getApp()
Page({
  data: {
    navindex: 0,
    According:false,
    nav: [
      { txt: '全部' },
      { txt: '已下单' },
      { txt: '服务中' },      
      { txt: '已完成' },
      { txt: '待评价' },
    ],
    orderdeil: [
      { title: '灯泡', fuwu: '等待服务', time: '2018-12-05', ads: '海洋大厦', price: '20.22', beizhu:' 地方的发的'},
      { title: '灯泡', fuwu: '订单已完成', time: '2018-12-05', ads: '海洋大厦', price: '20.22', beizhu: ' 地方的发的' },
      { title: '灯泡', fuwu: '服务中', time: '2018-12-05', ads: '海洋大厦', price: '20.22', beizhu: ' 地方的发的' },
      { title: '灯泡', fuwu: '待评价', time: '2018-12-05', ads: '海洋大厦', price: '20.22', beizhu: ' 地方的发的' },
      

    ],
    indicatorDots: true,
    autoplay: true,
    interval: 5000,
    duration: 1000,
    userInfo: {}
  },
  //底部
  index: function () {
    app.radTo('../index/index')
  },
  list: function () {
    app.radTo('../lists/lists')
  },
  order: function () {
    app.radTo('../order/order')
  },
  my: function () {
    app.radTo('../my/my')
  },
  click: function (e) {
    var id = e.currentTarget.dataset.id;
    console.log(id)
    this.setData({
      navindex: id
    })
    // wx.request({
    //   url: 'https://yunying.135k.com/api/goods/myposs',
    //   data: {
    //   },
    //   success: function (res) {
    //     that.setData({
    //       list: res.data.data
    //     })
    //   }
    // })
  },
  kdxq:function(e){
    console.log(e)
    var id = e.currentTarget.dataset.id;
    app.navTo('../orderdeil/orderdeil?id=' + id)
    
  },
  again: function (e) {
    app.navTo('../placeorder/placeorder')
  },
  bindViewTap: function () {

  },
  onLoad: function (e) {
    getApp().editTabBar(); 
    var orderdeil = this.data.orderdeil;    
    for (var i = 0; i < orderdeil.length;i++){
      if (orderdeil[i].fuwu == "等待服务") {
        orderdeil[i]["color"] = '#ff9833'
      } else if (orderdeil[i].fuwu == "订单已完成") {
        orderdeil[i]["color"] = '#45be3c'
      } else if (orderdeil[i].fuwu == "服务中") {
        orderdeil[i]["color"] = '#ff9833'
      } else {
        orderdeil[i]["color"] = '#45be3c'
      }
    }
    this.setData({
      orderdeil: orderdeil
    })
  },
  onShow:function(){
    let that = this;
    var HQgoods = that.data.orderdeil;
    if (HQgoods.length == 0) {
      that.setData({
        According: true,
      })
    } else {
      that.setData({
        According: false,
      })
    }
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})  
